home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / libc / sun3.md / modf.s < prev   
Text File  |  1988-06-19  |  834b  |  34 lines

  1.     .data
  2. /*    .asciz    "@(#)modf.s 1.1 86/09/24 SMI"    */
  3.     .text
  4.  
  5. |       Copyright (c) 1986 by Sun Microsystems, Inc.
  6.  
  7. #include "fpcrtInt.h"
  8.  
  9. /*
  10.  * double
  11.  * modf( value, iptr)
  12.  *      double value, *iptr;
  13.  *
  14.  * return a value v and stores through iptr a value i s.t.:
  15.  *    v + i == value, and
  16.  *4.2 BSD:
  17.  *    1 > v >= 0
  18.  *    Note that for -0.5 < value < 0, v may not be representable.
  19.  *System V:
  20.     v has sign of value and |v| < 1.
  21.     v is always exact.
  22.  */
  23.  
  24. ENTRY(modf)
  25.     moveml    PARAM,d0/d1    | d0/d1 gets x.
  26. |    jsr    Vfloord        | d0/d1 gets floor(x). 4.2 BSD definition.
  27.      jsr    Faintd        | d0/d1 gets aint(x). System V definition.
  28.     movl    PARAM3,a0    | a0 gets address of *iptr.
  29.     moveml    d0/d1,a0@    | *iptr gets floor(x).
  30.     lea    PARAM,a0    | a0 points to x.
  31.     jsr    Fsubd        | d0/d1 gets floor(x)-x.
  32.     bchg    #31,d0        | d0/d1 gets x-floor(x) >= 0 unless x is inf or nan.
  33.     RET
  34.